<div class="wrapper">
    <form id="add_ip_form" order="{{ order_name }}">
        <div id="add_ip_to_order_content" order="{{ order_name }}" style="display:none">
            <table>
                <tr>
                    <td width="1">
                        Количество ip:<input type="text" name="ip_count" order="{{ order_name }}" />
                    </td>
                    <td class="status" align="left"></td>
                </tr>
            </table>
            <a href="" id="add_ip_to_order" order="{{ order_name }}">добавить</a>
            <div id="load_icon_create_ip" order="{{ order_name }}" style="display:none">
                Отправление запроса <img alt="загрузка" src="{{ asset('bundles/billing/i/load.gif') }}">
            </div>
        </div>
    </form>
    <a href="" id="add_ip_to_order_link" order="{{ order_name }}">Добавить ip к заказу</a>
    <div id="ip_list" order="{{ order_name }}">
        <table>
            <tr>
                <td>
                    IP-адрес
                </td>
                <td>
                    Имя
                </td>
                <td>
                    MAC-адрес
                </td>
                <td>
                </td>
            </tr>
        {% for ip in ips %}
            <div id="ip_item" order="{{ order_name }}">
                <tr>
                    <td>
                        {{ ip.getIp() }}
                    </td>
                    <td>
                        {% if ip.getName() %}
                            {{ ip.getName() }}
                        {% else %}
                            -
                        {% endif %}
                    </td>
                    <td>
                        {% if ip.getMac() %}
                            {{ ip.getMac() }}
                        {% else %}
                            -
                        {% endif %}
                    </td>
                    <td>
                        {% if ip.IsActive() %}
                            <div id="load_icon_wait_ip" order="{{ order_name }}" ip="{{ ip.getIp() }}" style="display:none">
                        {% else %}
                            <div id="load_icon_wait_ip" order="{{ order_name }}" ip="{{ ip.getIp() }}">
                        {% endif %}
                            Создание домена  <img alt="загрузка" src="{{ asset('bundles/billing/i/load.gif') }}">
                        </div>
                    </td>
                </tr>
            </div>  
        {% endfor %}
    </div>
    <script type="text/javascript">
    var validator = $('#add_ip_form[order="{{ order_name }}"]').validate({
            rules: {
                    ip_count: {
                            number: true,
                            required: true,
                            min: 1
                    }
            },
            messages: {
                    ip_count: {
                            number: "Неправильный формат",
                            required: "Введите количество",
                            min: jQuery.format("Не менее {0}")
                    }
            },

            errorPlacement: function(error, element) {
                    error.appendTo( element.parent().next() );
            },
            success: function(label) {
                    // set &nbsp; as text for IE
                    label.html("&nbsp;").addClass("checked");
            }
    });
    </script>
</div>
